<!--
 * @Author: 曹捷
 * @Date: 2020-11-24 22:55:31
 * @LastEditors: 曹捷
 * @LastEditTime: 2021-01-21 09:55:50
 * @Description: 提示框  吐司 1
-->
<template>
  <uni-popup :ref="createKey" type="dialog">
    <div class="obit-toast" @click="close">
      <i class="iconfont " :class="options.icon"></i>
      <pre class="content p-b-10">{{options.content}}</pre>
    </div>
  </uni-popup>
</template>

<script>
export default {
  data () {
    return {
      options: {
        icon: 'icon-point',
        content: '',
      },
      createKey: ''
    }
  },
  methods: {
    open (option) {
      Object.assign(this.options, option)
      this.$refs[this.createKey].open()
    },
    close () {
      this.$refs[this.createKey].close()
    },
    dialogClose (done) {
      if (this.options.close) {
        return this.options.close(done)
      } else {
        done()
      }

    },
    confirm (done) {
      if (this.options.confirm) {
        this.options.confirm(done)
      } else {
        done()
      }
    }
  },
  created () {
    this.createKey = Math.random() * 1000;
  },
}
</script>

<style lang="scss">
.obit-toast {
  background: #efefef 90%;
  width: 410rpx;
  min-height: 170rpx;
  border-radius: 16rpx;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #666;
  align-items: center;
  .iconfont {
    font-size: 40rpx;
  }
  .content {
    font-size: 24rpx;
    padding: 0 20rpx;
  }
}
</style>